-
Notifications
You must be signed in to change notification settings - Fork 211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync2: dbset: use single connection for each sync session #6446
Open
ivan4th
wants to merge
8
commits into
develop
Choose a base branch
from
sync2/dbset-conns
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This adds a possibility to take a connection from the pool to use it via the Executor interface, and return it later when it's no longer needed. This avoids connection pool overhead in cases when a lot of quries need to be made, but the use of read transactions is not needed. Using read transactions instead of simple connections has the side effect of blocking WAL checkpoints.
Using single connection for multiple SQL queries which are executed during sync avoids noticeable overhead due to SQLite connection pool delays. Also, this change fixes memory overuse in DBSet. When initializing DBSet from a database table, there's no need to use an FPTree with big preallocated pool for the new entries that are added during recent sync.
ivan4th
requested review from
dshulyak,
fasmat,
poszu,
acud and
jellonek
as code owners
November 11, 2024 09:59
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #6446 +/- ##
=========================================
- Coverage 79.9% 79.9% -0.1%
=========================================
Files 352 352
Lines 46096 46148 +52
=========================================
+ Hits 36865 36894 +29
- Misses 7142 7162 +20
- Partials 2089 2092 +3 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
spacemesh-bors
bot
changed the base branch from
feature/long-db-conns
to
develop
November 17, 2024 21:46
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation
Using single connection for multiple SQL queries which are executed
during sync avoids noticeable overhead due to SQLite connection pool
delays.
Description
This makes derived DBSet used for each peer sync to use a dedicated connection,
without requesting the connection from pool multiple times.
Also, this change fixes memory overuse in DBSet. When initializing
DBSet from a database table, there's no need to use an FPTree with big
preallocated pool for the new entries that are added during recent sync.
There was an issue with Advance() crashing on a derived DBSet, which
is fixed, too.